package com.qf.openapi.web.master.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.openapi.web.master.dao.ApiMappingDao;
import com.qf.openapi.web.master.entity.ApiMapping;
import com.qf.openapi.web.master.entity.User;
import com.qf.openapi.web.master.service.ApiMappingSevice;
import com.qf.openapi.web.master.vo.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.IOException;
import java.util.List;

@Service
@Slf4j
public class ApiMappingSeviceImpl implements ApiMappingSevice {

	@Autowired
	private ApiMappingDao apiMappingDao;


	@Override
	public TableVo< ApiMapping > getApiMappings( Integer page,Integer limit ) {

		PageHelper.startPage( page,limit );
		List< ApiMapping > apiMappings=apiMappingDao.getApiMappings( );

		PageInfo< ApiMapping > objectPageInfo=new PageInfo<>(apiMappings );
		int total=(int)objectPageInfo.getTotal( );

		TableVo< ApiMapping > successful=new TableVo<>( 0,"Successful",total,apiMappings );
		return successful;
	}

	
}
